package com.aierjun.ani.utils.sensitiveword;

import android.content.Context;

import java.util.Set;

/**
 * Created by Ani_aierJun on 2017/10/12.
 */

public class TestSample {
    public String test(Context context,String s){
        SensitivewordFilter filter = new SensitivewordFilter(context);
        System.out.println("敏感词的数量：" + filter.sensitiveWordMap.size());
        System.out.println("待检测语句字数：" + s.length());
        //long beginTime = System.currentTimeMillis();
        Set<String> set = filter.getSensitiveWord(s, 2);
        //long endTime = System.currentTimeMillis();
        System.out.println("语句中包含敏感词的个数为：" + set.size() + "。包含：" + set);
        //System.out.println("总共消耗时间为：" + (endTime - beginTime));
        String aa = filter.replaceSensitiveWord(s, 2, "*");//替换*
        return aa;
    }
}
